<?php
/**
 * Created by PhpStorm.
 * User: 式神 (luck48.com)
 * Email: 289650682@qq.com
 * Name: ${NAME}Administrator
 * Date: 2017-04-10
 * Time: 14:15
 */
namespace App\Http\Controllers\Home;

use App\Http\Models\Article;
use App\Http\Models\Category;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Route;

class ContentController extends CommonController
{
    //主页
    public function index(){
        $route=Route::Input('id');
        if($route){
            $id=$route;
        }else{
            $id=0;
        }
        $article=new Article();
        if($id!=0){
            $data=$article->where('id',$id)->first();
        }else{
            $data=$article->first();
        }
        $template=$data->template?$data->template:'show';
        return view($this->template.'.'.$template,compact('data'));
    }

}

